import axios from "axios";
import { ElMessage } from "element-plus";
const baseURL = 'https://www.damerw.com/api/'
const instance = axios.create({
    baseURL,
    timeout:10000
})
//请求拦截器
instance.interceptors.request.use((config)=>{
// config.withCredentials=true

return config
})
instance.interceptors.response.use((res)=>{
    // console.log(res);
    if(res.data.code == 200){
        return res.data
    }

},
(err)=>{
    Promise.reject(err)
if(err.response?.status == 404){
    ElMessage.error('接口未开通')
}
}
)

export default instance